﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>用户登录</title>
    <link href="~/Content/css/style.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Content/layer-v2.1/layer/layer.js"></script>
    <script src="~/Scripts/cloud.js"></script>
    <script language="javascript">
        $(function () {
            $('.loginbox').css({ 'position': 'absolute', 'left': ($(window).width() - 692) / 2 });
            $(window).resize(function () {
                $('.loginbox').css({ 'position': 'absolute', 'left': ($(window).width() - 692) / 2 });
            });
            $(window).keyup(function (event) {
                if (event.keyCode == 13) {
                    login();
                }
            });
        });
        ///用户登录
        function login() {
            var loginCode = $("#txtUserCode").val();
            var loginPwd = $("#txtUserPwd").val();
            if (loginCode.length <= 0) {
                layer.tips('请输入您的登录账号！', "#txtUserCode", {
                    tips: [2, 'red'],
                    time: 2000
                });
                return false;
            }
            if (loginPwd.length <= 0) {
                layer.tips('请输入您的登录密码！', "#txtUserPwd", {
                    tips: [2, 'red'],
                    time: 2000
                });
                return false;
            }
            var load = layer.msg('正在登录，请稍后', { icon: 16, time: 0, shade: [0.3, '#000'] });
            var url = '@Url.Action("SubUserLogin")';
            $.post(url, { code: loginCode, pwd: loginPwd }, function (data) {
                if (data > 0) {
                    window.location.href = '@Url.Action("Index", "Home")';
                } else {
                    layer.msg("用户名或密码错误，请重新输入", { icon: 2, time: 2000, shade: [0.3, '#000'] });
                }
            });
        }
    </script>
</head>
<body style="background-color: #1c77ac; background-image: url('../Content/images/light.png'); background-repeat: no-repeat; background-position: center top; overflow: hidden;">
    <div id="mainBody">
        <div id="cloud1" class="cloud"></div>
        <div id="cloud2" class="cloud"></div>
    </div>
    <div class="loginbody">
        <span class="systemlogo" style="margin-top:60px"></span>
        <div class="loginbox">
            <ul>
                <li><input type="text" class="loginuser" id="txtUserCode" /></li>
                <li>
                    <input type="password" class="loginpwd" id="txtUserPwd" />
                </li>
                <li><input type="button" class="loginbtn" value="登录" onclick="login();" /></li>
            </ul>
        </div>
    </div>
    <div class="loginbm" style="color:black">版权所有  中石化西南分公司</div>
</body>
</html>
